Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/NodeSurface.kt 01cd54907d62cd90913d3d071b6bc240cae365ef (01cd5490) Text, 2.31 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.component

Tff7b72import T7ee787androidx.compose.foundation.BorderStroke
Tff7b72import T7ee787androidx.compose.material3.CardDefaults
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.ui.graphics.Color
Tff7b72import T7ee787androidx.compose.ui.graphics.lerp
Tff7b72import T7ee787androidx.compose.ui.unit.dp

T8b949e/**
* Shared node-tinted surface treatment so node cards and message bubbles match. A node's identity color is applied as a
* faint wash over the neutral card surface plus a node-colored outline — the more accessible alternative to a heavily
* saturated fill, since content keeps the surface/onSurface AA pairing while still reading as "this node".
*/
Tff7b72const Tff7b72val Te6edf3NODE_TINT_NORMAL Tff7b72= T79c0ff0.08f
Tff7b72const Tff7b72val Te6edf3NODE_TINT_EMPHASIZED Tff7b72= T79c0ff0.16f
Tff7b72const Tff7b72val Te6edf3NODE_TINT_MUTED Tff7b72= T79c0ff0.04f

Tff7b72private Tff7b72const Tff7b72val Te6edf3NODE_BORDER_ACTIVE_ALPHA Tff7b72= T79c0ff0.65f
Tff7b72private Tff7b72const Tff7b72val Te6edf3NODE_BORDER_INACTIVE_ALPHA Tff7b72= T79c0ff0.3f

T8b949e/** Neutral card surface washed [fraction] toward [nodeColor]; falls back to the plain surface when transparent. */
Tf0883e@Composable
Tff7b72fun Td2a8ffnodeTintedContainerTb4b4b4(Te6edf3nodeColorTb4b4b4: Te6edf3ColorTb4b4b4, Te6edf3fractionTb4b4b4: Tffa657Float Tff7b72= Te6edf3NODE_TINT_NORMALTb4b4b4)Tb4b4b4: Te6edf3Color Tb4b4b4{
Tff7b72val Te6edf3base Tff7b72= Te6edf3CardDefaultsTb4b4b4.Te6edf3cardColorsTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3containerColor
Tff7b72return Tff7b72if Tb4b4b4(Te6edf3nodeColor Tff7b72=Tff7b72= Te6edf3ColorTb4b4b4.Te6edf3TransparentTb4b4b4) Te6edf3base Tff7b72else Te6edf3lerpTb4b4b4(Te6edf3baseTb4b4b4, Te6edf3nodeColorTb4b4b4, Te6edf3fractionTb4b4b4)
Tb4b4b4}

T8b949e/** Node-colored outline; [active] (selected / online) uses a stronger alpha. Null when there's no node color. */
Tff7b72fun Td2a8ffnodeBorderStrokeTb4b4b4(Te6edf3nodeColorTb4b4b4: Te6edf3ColorTb4b4b4, Te6edf3activeTb4b4b4: Tffa657BooleanTb4b4b4)Tb4b4b4: Te6edf3BorderStroke? Tff7b72= Tff7b72if Tb4b4b4(Te6edf3nodeColor Tff7b72=Tff7b72= Te6edf3ColorTb4b4b4.Te6edf3TransparentTb4b4b4) Tb4b4b4{
Tff7b72null
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3BorderStrokeTb4b4b4(
T79c0ff1.5Tb4b4b4.Te6edf3dpTb4b4b4,
Te6edf3nodeColorTb4b4b4.Te6edf3copyTb4b4b4(Te6edf3alpha Tff7b72= Tff7b72if Tb4b4b4(Te6edf3activeTb4b4b4) Te6edf3NODE_BORDER_ACTIVE_ALPHA Tff7b72else Te6edf3NODE_BORDER_INACTIVE_ALPHATb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s